<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>积分明细</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css" />
		<link rel="stylesheet" href="style/css/integral_subsidiary.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/mockjs/dist/mock.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
	</head>
	<body>
		<div id="header">
			<h1>通知</h1>
			<span class="backicon"></span>
		</div> 
		<div id="notice">
		    <div style="padding-top: 50px;" class="tab">
				<!--<ul class="tabcontent clearfix">
					<li class="left_tab active" @tap="sysList">系统通知</li>
					<li class="right_tab" @tap="recList">推荐通知</li>
				</ul>-->
				<div id="refreshContainer">
					<div v-if="flag">
						<div class="intergral_list" v-for="sysnotice in systeMsg">
							<span class="time">{{fTime(sysnotice.create_time)}}</span>
							<div class="up">
								<span class="text_color ">{{sysnotice.title}}</span>
								<span class="gray">{{sysnotice.content}}</span>
							</div>
						</div>
					</div>
				</div>
			</div>	
		</div>
	</body>
	<script>
        new Vue({
        	el:"#notice",
        	data:{
        		systeMsg:"",
        		recommandMsg:"",
        		flag:true,
        		ticket:"",
				sign:""
        	},
        	methods:{
//      		sysList:function(){
//      			this.flag=true;
//      		},
//      		recList:function(){
//      			this.flag=false;
//      		}
                fTime:function(timestamp){
                	if (typeof timestamp == "undefined") {
				        timestamp = Math.round(new Date().getTime() / 1000)
				    }
				    var n = parseInt(timestamp) * 1000
				    var date = new Date(n);
				    var Y = date.getFullYear() + '-';
				    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				    var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
				    var H=date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
				    var Min=date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
				    var S=date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
				    return (Y + M + D)
                }
        	},
        	created:function(){
                this.ticket=localStorage.getItem("tick")
                this.sign=localStorage.getItem("sig")
        	},
        	mounted:function(){
        		var p=1;
				var that=this; 
				mui.plusReady(function(){
					mui.init({
					  pullRefresh : {
					    container:"#refreshContainer",
					    down : {
					      style:'circle',
					      color:'#2BD009', 
					      height:'50px',
					      range:'100px', 
					      offset:'0px', 
					      contentdown:null,
					      auto: true,
					      callback :pullrefesh  	      
					    }
					  }
					}); 
				})
				function pullrefesh(){
					that.$http.post(domain+"/member_msg/getList?t="+that.ticket+"&sign="+that.sign,{
					      	page:p++,
					      	page_size:2
					      },{emulateJSON:true}).then(
				            function (res) {
				                // 处理成功的结果
				                console.log(res.body)
				                if(res.body.code==1){
				                	if(res.body.data.length==0){
					                	mui.toast("没有更多了")
					                	return false;
					                }
				                    that.systeMsg=res.body.data.list;
				                }else{
				                	mui.toast("暂无商品")
				                }
				            },function (res) {
				            // 处理失败的结果
				            console.log(res) 
				            }
				        ).then(function(){
				        	mui('#refreshContainer').pullRefresh().endPulldownToRefresh();   
				        });
					
				} 
        	}
        })
	</script>

</html>